package com.example.springboot1.Service.impl;

import com.example.springboot1.Service.UserService;
import com.example.springboot1.mapper.UserMapper;
import com.example.springboot1.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    public UserMapper userMapper;

    //根据ID查询
    @Override
    public User getUserById(Integer id) {
        return userMapper.getUserById(id);
    }

    //分页
    @Override
    public List<User> selectPage(Integer pageNum, Integer pageSize) {
        List<User> list = userMapper.selectPage(pageNum,pageSize);
        return list;
    }

    //添加
    @Override
    public int InsertUser(User user) {
        int i = userMapper.InsertUser(user);
        return i;
    }

    //修改
    @Override
    public int updateUser(User user) {
        int i = userMapper.updateUser(user);
        return i;
    }

    //删除
    @Override
    public int deleteUser (Integer id) {
        return userMapper.deleteUser(id);
    }

    @Override
    public String login1(User user, String code) {
        return null;
    }

    @Override
    public String login2(User user) {
        return null;
    }

    @Override
    public void updateUserPwd(User user) {

    }
}
